package jp.co.sapporobeer.fmcoutgoingr2;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.LinearLayout;

public class SplashActivity extends Activity implements AnimationListener {
	 /** Called when the activity is first created. */
	 @Override
	 public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	     getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	     requestWindowFeature(Window.FEATURE_NO_TITLE);		 
		 setContentView(R.layout.splashactivity);
		 splashAnimation();
		 Handler hdl = new Handler();
		 hdl.postDelayed(new splashHandler(), 3000);
	 }
	 class splashHandler implements Runnable {
			@Override
			public void run() {
				SplashActivity.this.finish();
			}		
	 }	 
	 
	 private void splashAnimation(){
		 AlphaAnimation alphaanime = new AlphaAnimation(1, 0);
		 alphaanime.setStartOffset(2000);
		 alphaanime.setDuration(1000);
		 alphaanime.setFillAfter(true);
		 alphaanime.setAnimationListener(this);
		 LinearLayout linear = (LinearLayout)findViewById(R.id.splashLinear);
		 linear.startAnimation(alphaanime);
	 }

	 @Override
	 public void onAnimationEnd(Animation animation) {
		 LinearLayout linear = (LinearLayout)findViewById(R.id.splashLinear);
		 linear.setVisibility(View.GONE);
	 }

	 @Override
	 public void onAnimationRepeat(Animation animation) {

	 }

	 @Override
	 public void onAnimationStart(Animation animation) {

	 }

}
